package com.stroke.tools.animation;

import javax.swing.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.awt.*;

/**
 * Author: Igor Bubelov
 * Date: 3/12/11 11:46 PM
 */
public class FrameListModel extends AbstractListModel {
    private List<Frame> frames = new ArrayList<Frame>();

    public int getSize() {
        return frames.size();
    }

    public Object getElementAt(int index) {
        return frames.get(index);
    }

    public void setElementAt(int index, Frame element) {
        frames.set(index, element);
    }

    public List<Frame> getElements() {
        return frames;
    }

    public void sortByPosition() {
        Collections.sort(frames, new FramePositionComparator());
    }
}
